using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FiltronASP.Helpers.Translations;

namespace FiltronASP.Helpers
{
    public class GlobalHelper
    {
        public static long GetTimestamp(DateTime date)
        {
            if (date == null)
            {
                return (long)(DateTime.Now.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
            }   //if
            return (long)(date.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
        }

        public static string TranslateMonths(string englishMonth, int languageName)
        {
            if (!englishMonth.Equals(""))
            {
                switch (englishMonth.ToLower())
                {
                    case "january":
                        return translationHelper.getTranslation("_monthJanuary", languageName);
                    case "february":
                        return translationHelper.getTranslation("_monthFebruary", languageName);
                    case "march":
                        return translationHelper.getTranslation("_monthMarch", languageName);
                    case "april":
                        return translationHelper.getTranslation("_monthApril", languageName);
                    case "may":
                        return translationHelper.getTranslation("_monthMay", languageName);
                    case "june":
                        return translationHelper.getTranslation("_monthJune", languageName);
                    case "july":
                        return translationHelper.getTranslation("_monthJuly", languageName);
                    case "august":
                        return translationHelper.getTranslation("_monthAugust", languageName);
                    case "september":
                        return translationHelper.getTranslation("_monthSeptember", languageName);
                    case "october":
                        return translationHelper.getTranslation("_monthOctober", languageName);
                    case "november":
                        return translationHelper.getTranslation("_monthNovember", languageName);
                    case "december":
                        return translationHelper.getTranslation("_monthDecember", languageName);
                }
            }
            return String.Empty;
        }

        public static string TranslateMonths(string englishMonth, string languageName)
        {
            if (!englishMonth.Equals(""))
            {
                switch (englishMonth.ToLower())
                {
                    case "january":
                        return translationHelper.getTranslation("_monthJanuary", languageName);
                    case "february":
                        return translationHelper.getTranslation("_monthFebruary", languageName);
                    case "march":
                        return translationHelper.getTranslation("_monthMarch", languageName);
                    case "april":
                        return translationHelper.getTranslation("_monthApril", languageName);
                    case "may":
                        return translationHelper.getTranslation("_monthMay", languageName);
                    case "june":
                        return translationHelper.getTranslation("_monthJune", languageName);
                    case "july":
                        return translationHelper.getTranslation("_monthJuly", languageName);
                    case "august":
                        return translationHelper.getTranslation("_monthAugust", languageName);
                    case "september":
                        return translationHelper.getTranslation("_monthSeptember", languageName);
                    case "october":
                        return translationHelper.getTranslation("_monthOctober", languageName);
                    case "november":
                        return translationHelper.getTranslation("_monthNovember", languageName);
                    case "december":
                        return translationHelper.getTranslation("_monthDecember", languageName);
                }
            }
            return String.Empty;
        }

    }
}
